package org.lanqiao.netctoss.controller.bill;

import java.io.IOException;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.lanqiao.netctoss.entity.Acount;
import org.lanqiao.netctoss.entity.Buss;
import org.lanqiao.netctoss.entity.CheckBill;
import org.lanqiao.netctoss.service.impl.BillServiceImpl;
import org.lanqiao.netctoss.service.impl.BussServiceImpl;

/**
 * Servlet implementation class CheckBillItemServlet
 */
public class CheckBillItemServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public CheckBillItemServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		String card = request.getParameter("che_card");
		String name = request.getParameter("che_name");
		String auser = request.getParameter("che_auser");
		String month = request.getParameter("che_month");
		String cost = request.getParameter("che_cost");
		List<Buss> lb = new BussServiceImpl().selectBussByAco_user(new CheckBill(request.getParameter("che_auser")));
		HttpSession session = request.getSession();
		session.setAttribute("lb", lb);
		session.setAttribute("name",name);
		session.setAttribute("card", card);
		session.setAttribute("auser", auser);
		session.setAttribute("month", month);
		session.setAttribute("cost", cost);
		RequestDispatcher rd =request.getRequestDispatcher("../view/bill/bill_item.jsp");
		rd.forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
